package cn.lg.soar.system.api.utils;

import cn.lg.soar.core.util.SoarSubscriber;
import cn.lg.soar.system.api.service.IUrlMappingApi;

import java.util.Map;

/**
 * 路径映射工具
 * @author luguoxiang
 * @date 2025-07-15
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
public class UrlMappingUtils {

    private static IUrlMappingApi api;
    static {
        SoarSubscriber.subscribeInit(applicationContext -> {
            api = applicationContext.getBean(IUrlMappingApi.class);
        });
    }

    /**
     * 获取url
     * @param group 分组
     * @param bizType 业务类型
     * @return
     */
    public static String getUrl(String group, String bizType) {
        return api.getUrl(group, bizType);
    }

    /**
     * 根据分组获取映射
     * @param group
     * @return
     */
    public static Map<String, String> getByGroup(String group) {
        return api.getByGroup(group);
    }

    /**
     * 获取全部映射
     * @return
     */
    public static Map<String, Map<String, String>> getMapping() {
        return api.getMapping();
    }

}
